# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=qt5-qtwebsockets
pkgver=5.15.5_git20220617
pkgrel=0
_commit="e5be9ba432929049da8f4788400c170bf71672da"
pkgdesc="Provides WebSocket communication compliant with RFC 6455"
url="https://www.qt.io/developers/"
arch="all"
license="(LGPL-3.0-or-later OR GPL-3.0-only OR GPL-2.0-or-later) AND Qt-GPL-exception-1.0"
makedepends="
	qt5-qtbase-dev
	qt5-qtdeclarative-dev
	"
subpackages="$pkgname-dev"
replaces="qt5-websockets"
options="!check" # No tests
builddir="$srcdir/qtwebsockets-$_commit"

case $pkgver in
	*_beta*|*_rc*) _rel=development_releases;;
	*) _rel=official_releases;;
esac

source="https://invent.kde.org/qt/qt/qtwebsockets/-/archive/$_commit/qtwebsockets-$_commit.tar.gz"

prepare() {
	default_prepare

	# We need to make the build system think we're running in a git repository
	# so it correctly symlinks during the build
	mkdir .git
}

build() {
	qmake-qt5
	make
}

package() {
	make INSTALL_ROOT="$pkgdir" install

	# Drop QMAKE_PRL_BUILD_DIR because reference the build dir
	find "$pkgdir/usr/lib" -type f -name '*.prl' \
		-exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;

	install -d "$pkgdir"/usr/share/licenses
		ln -s /usr/share/licenses/qt5-base "$pkgdir"/usr/share/licenses/$pkgname
}

sha512sums="
cb4fff63a5f0672cd679bc9cd45ed8692013b2e363901d01a5b87f7129e538c3f4618c1f84d66c89e284bfc76bc2ee2b2acc8542b71ffa3e9be92f5dd260c25e  qtwebsockets-e5be9ba432929049da8f4788400c170bf71672da.tar.gz
"
